﻿@model Wiwi.ViewModels.UserPitches 

@{
    ViewBag.Title = "Wiwi Pitch";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script type="text/jscript" >
    function SetHiddenValue(wid, status) {
        $('#HidPitch').val(wid);
        $('#HidPitchStatus').val(status);
    }
</script>

<div class="grid_8 box-shadow margin-top">
    	<h4 class="tabbed">Your Want</h4>

@using (Html.BeginForm()) {
    <input type ="hidden" id="HidPitch" name="HidPitch" />
    <input type ="hidden" id="HidPitchStatus" name="HidPitchStatus" />
  
     <div class="wiwi-pitches-box"> 
     
     @* !#! user image *@
     	<div class="left-col"> 
			<a href="#"><img src="../i/gravitar-04.png" width="48" height="48" alt="userName" ></a> 
		</div> 
 
        	<div class="right-col bigger-icon"> 

	    	    <h5>You<br /><span>Posted 2 days ago</span></h5> 
	    	
    		<p class="serif-it">@Model.Want.WantDesc.ToString()</p>
			
	    	
    <p class='tagged'>Tagged ~
             @if (Model.Want.Tags != "")
             {
                 string[] TagRows = Model.Want.Tags.Split('$');
                 foreach (string tr in TagRows)
                 {
                     if (tr != "")
                     {
                         string[] Tagss = tr.Split('?');
                         if (Tagss[0].Trim() != "")
                         {
        <a href='/Want/Pitch?Wuid=@Tagss[1].ToString()'>@Tagss[0]</a>
                         }
                     }
                 }
             }</p>	    	
    </div> 
</div>
    
<hr />   
          @* #end want  *@
   
             @* All pitches *@

             foreach (var pt in Model.Pitches)
             {
            
    <div class="wiwi-pitches-box"> 

        <div class="left-col"> 
			<a href="/Home/UserPublicProfile?Uid=@pt.UserSellerID" ><img height ="48" width="48" src='@Url.Action("ShowUserImage", "Home", new { Uid = @pt.UserSellerID })' /></a>
		</div>
       
        <div class="right-col bigger-icon"> 
               
              @if (pt.PitchStatus != null)
                    {
                        if (pt.PitchStatus == true)
                        {
                            	<ul class="user-choice">
				                    <li>@Html.ActionLink("Reply", "WantComm", "Want", new { Wid = pt.Want_Wanter_RelID, SuppID = pt.UserSellerID }, new { @class = "button-m  blue-button" })</li>
			                    </ul>	
 
                        }
                    } 
                
                <h5>Joe<br />
                              @{
              string durat = "";

              TimeSpan span = DateTime.Now - pt.PitchDate.Value;
              if (span.Minutes < 59 && span.Hours < 1 && span.Days < 1)
              {
                  durat += "Posted " + span.Minutes.ToString() + " Minutes ago";
              }
              if (span.Hours > 1 && span.Days < 1)
              {
                  durat += "Posted " + span.Hours.ToString() + " Hours ago";
              }
              if (span.Days > 1)
              {
                  durat += "Posted " + span.Days.ToString() + " Days ago";
              }
                 <span>@durat</span> 
                              }
                </h5> 
                <p class="serif-it">@pt.pitchtext</p>
                   
                    @if (pt.PitchStatus == null)
                    {
                        
                   <div class="user-pitch-choice">
                       <p class="green fLeft click"><input type="submit" value ="Accept Pitch" onclick="SetHiddenValue('@pt.WantWanterSellerID','Accept');" /></p>
                       <p class="red fRight click"><input type="submit" value ="Decline Pitch" onclick="SetHiddenValue('@pt.WantWanterSellerID','Reject');" /></p>
                   </div>
                        
                    }
                    
                 </div>
              
    </div>
    <hr class="mini" />
             }

}

</div>
